// SPDX-FileCopyrightText: 2023-2025 Sangfor Technologies Inc.
// SPDX-License-Identifier: Mulan PSL v2
package com.geniusai.aip.auth.domain;

import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

import static com.geniusai.aip.auth.constants.LoadConstants.NAME_FORMAT;
import static com.geniusai.aip.auth.constants.LoadConstants.PASSWORD_FORMAT;

/**
 * @author hml14563
 * @date 2021/3/26
 */
@Data
public class LoginEntity {
    @NotNull(message = "用户名称不能为空")
    @Pattern(regexp = NAME_FORMAT, message = "名称的格式不正确")
    @Length(max = 30, message = "用户名字长度需要在1和30之间")
    private String username;

    @Pattern(regexp = PASSWORD_FORMAT, message = "密码格式不正确")
    @NotNull(message = "用户密码不能为空")
    private String password;

    @NotNull(message = "验证码不能为空")
    private String code;

    @NotNull(message = "验证类型不能为空")
    private String grantType;

    @NotNull(message = "鉴权范围不能为空")
    private String scope;
}
